//
// Created by LinorInk on 2024/3/17.
//

#include "LED.h"
#include "task.h"

void LED_on() {
    HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_SET);
}

void LED_off() {
    HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_RESET);
}

void LED_toggle() {
    HAL_GPIO_TogglePin(LED_PORT, LED_PIN);
}

static taskTypedef LED_blinkTask;

/**
 * LED闪烁
 * @param tick 闪烁延迟
 */
void LED_blink(uint16_t tick) {
    Task_regist(&LED_blinkTask, tick, 0xff, LED_toggle);
}
